package com.jk.controller;

import com.jk.service.RecordService;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

/**
 * @ClassName ConsumerOne
 * @Descripttion TODO
 * @Author binzi
 * @Date 2022/10/23 16:23
 * @Version 0.001
 */
@Component
public class ConsumerOne {

    @Autowired
    private RecordService recordService;

    /**
    * @Author: binzi
    * @Description:
    * @Date: 2022/10/23 16:58
    * @Return: void
    **/
    @RabbitListener(queues = "binzi")
    public void receive(Integer record_id) throws IOException {
        recordService.updateStateById2(record_id);
        System.out.println("消费者二收到消息："+record_id);
    }
}
